package com.mkz.job.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import java.time.LocalTime;

/**
 * 任务信息
 *
 * @author KuangJianyu
 * @date 2020-04-17 14:33:41
 */
@Data
@TableName("xxl_job_info")
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value = "任务信息")
public class XxlJobInfo extends Model<XxlJobInfo> {
	private static final long serialVersionUID = 1L;

	public XxlJobInfo() {
	}

	public XxlJobInfo(JobInfoVo jobInfoVo) {
		this.jobCron = jobInfoVo.getJobCron();
		this.author = "AutoCreated";
		this.executorHandler = jobInfoVo.getExecutorHandler();
		this.jobDesc = jobInfoVo.getJobDesc();
		this.addTime = LocalDateTime.now();
		this.executorRouteStrategy = "FIRST";
		this.executorBlockStrategy = "SERIAL_EXECUTION";
		this.executorTimeout = 60;
		this.executorFailRetryCount = 1;
		this.glueType = "BEAN";
		this.glueUpdatetime = LocalDateTime.now();
		this.glueRemark = "AutoInit";
		this.triggerStatus = 1;
	}

	/**
	 * 
	 */
	@TableId
	@ApiModelProperty(value = "")
	private Integer id;
	/**
	 * 执行器主键ID
	 */
	@ApiModelProperty(value = "执行器主键ID")
	private Integer jobGroup;
	/**
	 * 任务执行CRON
	 */
	@ApiModelProperty(value = "任务执行CRON")
	private String jobCron;
	/**
	 * 
	 */
	@ApiModelProperty(value = "")
	private String jobDesc;
	/**
	 * 
	 */
	@ApiModelProperty(value = "")
	private LocalDateTime addTime;
	/**
	 * 
	 */
	@ApiModelProperty(value = "")
	private LocalDateTime updateTime;
	/**
	 * 作者
	 */
	@ApiModelProperty(value = "作者")
	private String author;
	/**
	 * 报警邮件
	 */
	@ApiModelProperty(value = "报警邮件")
	private String alarmEmail;
	/**
	 * 执行器路由策略
	 */
	@ApiModelProperty(value = "执行器路由策略")
	private String executorRouteStrategy;
	/**
	 * 执行器任务handler
	 */
	@ApiModelProperty(value = "执行器任务handler")
	private String executorHandler;
	/**
	 * 执行器任务参数
	 */
	@ApiModelProperty(value = "执行器任务参数")
	private String executorParam;
	/**
	 * 阻塞处理策略
	 */
	@ApiModelProperty(value = "阻塞处理策略")
	private String executorBlockStrategy;
	/**
	 * 任务执行超时时间，单位秒
	 */
	@ApiModelProperty(value = "任务执行超时时间，单位秒")
	private Integer executorTimeout;
	/**
	 * 失败重试次数
	 */
	@ApiModelProperty(value = "失败重试次数")
	private Integer executorFailRetryCount;
	/**
	 * GLUE类型
	 */
	@ApiModelProperty(value = "GLUE类型")
	private String glueType;
	/**
	 * GLUE源代码
	 */
	@ApiModelProperty(value = "GLUE源代码")
	private String glueSource;
	/**
	 * GLUE备注
	 */
	@ApiModelProperty(value = "GLUE备注")
	private String glueRemark;
	/**
	 * GLUE更新时间
	 */
	@ApiModelProperty(value = "GLUE更新时间")
	private LocalDateTime glueUpdatetime;
	/**
	 * 子任务ID，多个逗号分隔
	 */
	@ApiModelProperty(value = "子任务ID，多个逗号分隔")
	private String childJobid;
	/**
	 * 调度状态：0-停止，1-运行
	 */
	@ApiModelProperty(value = "调度状态：0-停止，1-运行")
	private Integer triggerStatus;
	/**
	 * 上次调度时间
	 */
	@ApiModelProperty(value = "上次调度时间")
	private Long triggerLastTime;
	/**
	 * 下次调度时间
	 */
	@ApiModelProperty(value = "下次调度时间")
	private Long triggerNextTime;
}
